#!/usr/bin/env python
# -*- coding:utf-8 -*-

import redis

# 普通连接
conn = redis.Redis(host="127.0.0.1", port=6379,password="")
conn.set("x1","hello",ex=5) # ex代表seconds，px代表ms
val = conn.get("x1")
print(val)


import redis

# 连接池
pool = redis.ConnectionPool(host="192.168.23.166", port=6379,password="",max_connections=1024)
conn = redis.Redis(connection_pool=pool)
print(conn.get("x1"))